/*
 * Vehicle.h
 *
 *  Created on: Aug 26, 2011
 *      Author: erudhes
 */
#ifndef VEHICLE_H_
#define VEHICLE_H_
#include <vector>
#include <wx/wx.h>
#include "SmartPointer.h"

/**
 * This class represents the moving car on the level
 *
 * @author Rudolf Heszele heszele@gmail.com
 * @version 1.0
 * @since 2012-03-08
 */
class Vehicle
{
	public:
		/**
		 * The only constructor takes the position of the vehicle, the bitmap containing the level, and the configured dotSize
		 *
		 * @param position The position of the Vehicle
		 * @param bitmap The bitmap containing the level. The Vehicle will be painted on
		 * @param dotSize The configured dot size for the level
		 */
		Vehicle(const wxPoint& position, SmartPointer<wxBitmap> bitmap, unsigned int dotSize);
		virtual ~Vehicle();
		const wxPoint& getPosition() const;
		const wxPoint& getSpeed() const;
		/**
		 * Calculated the valid next positions for the vehicle, based on the position and the speed of the Vehicle
		 *
		 * @return The list of the valid next positions
		 */
		std::vector<wxPoint> getValidNextPositions() const;
		/**
		 * Will move the Vehicle to the required position if possible
		 *
		 * @param nextPosition The requested position to move to
		 * @return true if the move was successfull, false if the move is not valid
		 */
		bool move(const wxPoint& nexPosition);
		/**
		 * Draws or erases the Vehicle from the level
		 *
		 * @param erase If true the Vehicle will be erased, otherwise it will be painted
		 */
		void draw(bool erase = false);

	private:
		wxPoint mPosition;
		wxPoint mSpeed;
		SmartPointer<wxBitmap> mBitmap;
		unsigned int mDotSize;
};

inline const wxPoint& Vehicle::getPosition() const
{
	return mPosition;
}

inline const wxPoint& Vehicle::getSpeed() const
{
	return mSpeed;
}

#endif /* VEHICLE_H_ */
